<?php
class PublicAction extends CommonAction {
	// 用户登录页面
	public function login() {
		if(!isset($_SESSION[C('USER_AUTH_KEY')])) {
			$this->display();
		}else{
			$this->redirect('Index/index');
		}
	}

	public function index()
	{
		//如果通过认证跳转到首页
		redirect(__APP__);
	}
	
	public function verify()
    {
		$type = isset($_GET['type'])?$_GET['type']:'gif';
        import("ORG.Util.Image");
        Image::buildImageVerify(4,1,$type,48,18);
    }
	
	public function checkName(){
		$user=M('User');
		if(!empty($_GET['username'])){
			if($user->getByUsername($_GET['username'])){
				echo 'false';
			}else{
				echo 'true';
			}
		}else{
				echo 'true';
		}
		
	}
	
	public function checkEmail(){
		$user=M('User');
		if(!empty($_GET['email'])){
			if($user->getByEmail($_GET['email'])){
				echo 'false';
			}else{
				echo 'true';
			}
		}else{
				echo 'true';
		}
		
	}

}
?>